package com.zhlb.zfba.modules.per.bean;

import java.util.Calendar;
import org.apache.commons.lang3.StringUtils;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.zhlb.zfba.common.utils.DateUtil;

public class SuspectPathLog {
	private String logGUID;
	private String inTime;
	private String staySeconds;
	private String outTime;
	private String suspectInfoGUID;
	private String suspectName;
	private String suspectIDNo;
	private String linkPostion;
	private String linkCam1;
	private String linkCam2;
	private String linkCam3;
	
	private int camCount;
	private String xmlData;//用于点击播放按钮时，存放xml格式字符串，传给服务器。
	public String getLogGUID() {
		return logGUID;
	}
	public void setLogGUID(String logGUID) {
		this.logGUID = logGUID;
	}
	public String getInTime() {
		return inTime;
	}
	public void setInTime(String inTime) {
		this.inTime = inTime;
	}
	public String getStaySeconds() {
		if (StringUtils.isNumeric(this.staySeconds)){
			this.staySeconds=DateUtil.formatDateTime(Long.parseLong(this.staySeconds));
		}
		return staySeconds;
	}
	public void setStaySeconds(String staySeconds) {
		this.staySeconds = staySeconds;
	}
	public String getOutTime() {
		return outTime;
	}
	public void setOutTime(String outTime) {
		this.outTime = outTime;
	}
	public String getSuspectInfoGUID() {
		return suspectInfoGUID;
	}
	public void setSuspectInfoGUID(String suspectInfoGUID) {
		this.suspectInfoGUID = suspectInfoGUID;
	}
	public String getSuspectName() {
		return suspectName;
	}
	public void setSuspectName(String suspectName) {
		this.suspectName = suspectName;
	}
	public String getSuspectIDNo() {
		return suspectIDNo;
	}
	public void setSuspectIDNo(String suspectIDNo) {
		this.suspectIDNo = suspectIDNo;
	}
	public String getLinkPostion() {
		return linkPostion;
	}
	public void setLinkPostion(String linkPostion) {
		this.linkPostion = linkPostion;
	}
	public String getLinkCam1() {
		return linkCam1;
	}
	public void setLinkCam1(String linkCam1) {
		this.linkCam1 = linkCam1;
	}
	public String getLinkCam2() {
		return linkCam2;
	}
	public void setLinkCam2(String linkCam2) {
		this.linkCam2 = linkCam2;
	}
	public String getLinkCam3() {
		return linkCam3;
	}
	public void setLinkCam3(String linkCam3) {
		this.linkCam3 = linkCam3;
	}
	public void setCamCount(int camCount) {
		this.camCount = camCount;
	}
	public void setXmlData(String xmlData) {
		this.xmlData = xmlData;
	} 
	/**
	 * 计算摄像机数量
	 * @return
	 */
	public int getCamCount() {
		int count=0;
		if(this.linkCam1!=null&&!"".equals(this.linkCam1)){
			count++;
		}
		if(this.linkCam2!=null&&!"".equals(this.linkCam2)){
			count++;
		}
		if(this.linkCam3!=null&&!"".equals(this.linkCam3)){
			count++;
		}
		return count;
	}
	/**
	 * 获取xml数据
	 * @return
	 */
	@JsonIgnore
	public String getXmlData() {
		if(this.inTime.length()<10){
			return null;
		}
		Calendar beginCalendar=DateUtil.getCalendar(this.inTime);
		String tempValue="";
		//记录ID@;@位置@;@描述@;@摄像机数量@;@镜头1名称@;@镜头2名称@;@年@;@月@;@日@;@时@;@分@;@秒
		tempValue=this.logGUID+"@;@"+
				 ((this.linkPostion==null)?"":this.linkPostion)+"@;@"+
//				 ((this.posDev==null)?"":this.posDev)+"@;@"+
				 "描述"+"@;@"+
				  this.getCamCount()+"@;@"+
				 (StringUtils.isBlank(this.linkCam1)?"":this.linkCam1)+"@;@"+
				 (StringUtils.isBlank(this.linkCam2)?"":this.linkCam2)+"@;@"+
				 (StringUtils.isBlank(this.linkCam3)?"":this.linkCam3)+"@;@"+
				  beginCalendar.get(Calendar.YEAR)+"@;@"+
				  (beginCalendar.get(Calendar.MONTH) + 1)+"@;@"+
				  beginCalendar.get(Calendar.DAY_OF_MONTH)+"@;@"+
				  beginCalendar.get(Calendar.HOUR_OF_DAY)+"@;@"+
				  beginCalendar.get(Calendar.MINUTE)+"@;@"+
				  beginCalendar.get(Calendar.SECOND)+"@;@"+
				  (StringUtils.isBlank(this.staySeconds)?"0":this.staySeconds);
		return tempValue;
	}
}
